
from selenium.webdriver import Chrome
from selenium.webdriver.common.keys import Keys
import time
from Chaojiying_Python.chaojiying import Chaojiying_Client

web = Chrome(r'D:\谷歌\Google\Chrome\Application\chromedriver.exe')
web.get("http://www.chaojiying.com/user/login/")
# 账号密码
web.find_element_by_xpath('/html/body/div[3]/div/div[3]/div[1]/form/p[1]/input').send_keys('2289426873')
web.find_element_by_xpath('/html/body/div[3]/div/div[3]/div[1]/form/p[2]/input').send_keys('guoxin0814..')
# 验证码
img = web.find_element_by_xpath('/html/body/div[3]/div/div[3]/div[1]/form/div/img').screenshot_as_png

chaojiying = Chaojiying_Client()
yanzhengma = chaojiying.PostPic(img, 1902)
print('验证码：' + yanzhengma['pic_str'])

web.find_element_by_xpath('/html/body/div[3]/div/div[3]/div[1]/form/p[3]/input').send_keys(yanzhengma['pic_str'])

web.find_element_by_xpath('/html/body/div[3]/div/div[3]/div[1]/form/p[4]/input').click()






